<template>
	<view class="com-novel-list">
		<view class="novel-box" v-for="(item,index) in list" :key="item.id" @tap="novelTap(item)">
			<view class="content">
				<image class="default-cover cover" :data-cover="item.cover?'':'暂无封面'" :src="item.cover"
					mode="scaleToFill">
				</image>
				<view class="right">
					<view class="title">{{item.title}}</view>
					<view class="author-cat">
						{{item.author}}
						<text v-if="item.cat" class="split">·</text>
						{{item.cat}}
						<text v-if="item.wordCount" class="split">·</text>
						{{item.wordCount}}
					</view>
					<view v-if="item.lastChapter" class="desc">{{item.lastChapter}}</view>
					<view v-if="item.shortIntro" class="desc">{{item.shortIntro}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
				type: Array,
				default: () => []
			}
		},
	}
</script>

<style lang="scss" scoped>
	.com-novel-list {}

	.novel-box {
		padding: 30rpx;

		&:active {
			background-color: #f3f3f3;
		}

		&:nth-child(n+2) {
			border-top: 2rpx solid #f8f8f8;
		}

		.content {
			display: flex;
			justify-content: flex-start;

			.cover {
				position: relative;
				width: 120rpx;
				height: 160rpx;
				border: 2rpx solid #E8E8E8;
				background-image: linear-gradient(to right bottom, rgba(0, 0, 255, 0.5), rgba(255, 0, 0, 0.5));

				&::after {
					content: "暂无封面";
					font-size: 22rpx;
					color: #525252;
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
				}
			}

			.right {
				width: 570rpx;
				padding-left: 30rpx;
				box-sizing: border-box;

				.title {
					// font-size: 28rpx;
					font-weight: bold;
				}

				.author-cat {
					color: #999;
					font-size: 26rpx;
					height: 40rpx;
					line-height: 40rpx;

					.split {
						padding: 0 16rpx;
					}
				}

				.desc {
					color: #999;
					font-size: 26rpx;
					height: 40rpx;
					line-height: 40rpx;

					overflow: hidden;
					text-overflow: ellipsis;
					word-break: break-all;
					display: -webkit-box;
					-webkit-line-clamp: 1;
					-webkit-box-orient: vertical;
				}
			}
		}
	}
</style>
